package top.zkh.login;

import java.io.IOException;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.java1234.dao.animaledDao;
import com.java1234.model.animaled;
import com.java1234.util.DbUtil;
public class buyServlet extends HttpServlet{
	private DbUtil dbUtil=new DbUtil();
	private animaledDao animaleddao=new animaledDao();
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding ("utf-8");
		resp.setContentType("text/html;carset=utf-8");	
			List<animaled> animal2 = new ArrayList<animaled>();
			animaled animal1 = new animaled();
			Connection con=null;
			try {
				con=dbUtil.getCon();
				animal2=animaleddao.find(con);
	
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			};
			
			req.setAttribute("aList", animal2);	
			req.getRequestDispatcher("buyfind.jsp").forward(req, resp);
		}				
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doGet(req, resp);
	}
}
